Given the profound disruptions caused by the COVID-19 pandemic, which has significantly interrupted daily life and global events, employing an interrupted time series analysis is particularly apt. This method allows us to quantitatively assess the pandemic’s impact on key socio-economic indicators. In our project, we have chosen to focus on Pfizer stock prices and GDP per capita as two pivotal metrics. By analyzing these indicators, we aim to capture and understand the extent of COVID-19’s effects on both the corporate sector, specifically pharmaceuticals, and broader economic health. This approach will enable us to isolate the direct impacts of the pandemic from other variables and gain insights into the resilience and responsiveness of different economic sectors during such global crises. In these examples, we all selected 2020 February 20th as the treatment date to research.
1.1 GDP Per Capita
Code
gdp <-read_csv('Datasets/gdp.csv')# Convert DATE column from m/d/yy format to Date object and reformat to "Year" only for simplicitygdp$DATE <-format(mdy(gdp$DATE), "%Y/%m/%d")# Convert GDP column to numeric (floating-point) format if not alreadygdp$GDP <-as.numeric(gdp$GDP)# Visualize the plotstart_year <-year(min(gdp$DATE))start_month <-month(min(gdp$DATE))end_year <-year(max(gdp$DATE))end_month <-month(max(gdp$DATE))# Calculate the number of observations from start to endnum_obs <- (end_year - start_year) *4+ceiling((end_month - start_month) /3)# data glimpsehead(gdp, 3)
# A tibble: 3 × 2
DATE GDP
<chr> <dbl>
1 2017/01/01 19280.
2 2017/04/01 19439.
3 2017/07/01 19693.
Code
fig <-plot_ly(gdp, x =~DATE, y =~GDP,name ='GDP Per Capita', type ='scatter', mode ='lines')fig
Code
# Create the time series object#gdp_ts <- ts(gdp$GDP, start = c(start_year, start_month), frequency = 4, deltat = 0.25)dataTS <-data.frame("Y"=gdp$GDP)dataTS$Ts<-seq(1:length(gdp$GDP))dataTS$D <-ifelse(gdp$DATE <as.Date("2020-02-20"), 0, 1)dataTS$P<-seq_along(gdp$DATE)dataTS$P[gdp$DATE <as.Date("2020-02-20")] <-0head(dataTS)
index_of_2020_02_20 <-which(gdp$DATE ==as.Date("2020-04-01"))#index_of_2020_02_20 #14plot( dataTS$Ts, dataTS$Y,bty="n", pch=19, col="gray",xlab ="Time", ylab ="GDP Per Capita" )# Line marking the interruptionabline( v=13, col="firebrick", lty=2 )text( 9, 24000, "Start of COVID", col="firebrick", cex=1.3, pos=4 )# Add the regression linets <-lm( Y ~ Ts + D + P, data=dataTS )lines( dataTS$Ts, ts$fitted.values, col="steelblue", lwd=2 )
Pre-COVID Trend: Prior to the dashed red line labeled “Start of COVID,” there is a positive trend in GDP per capita, indicating economic growth. This is represented by the blue line, which is the fitted line from a regression model, showing the upward trajectory of GDP per capita over time.
COVID-19 Impact: The dashed red line signifies the point at which the COVID-19 pandemic began. Following this line, there’s a noticeable dip in GDP per capita, reflecting the immediate economic impact of the pandemic. This downturn signifies a break from the previous growth trend.
Post-COVID Recovery: After the initial dip, the blue fitted line indicates that GDP per capita began to recover, continuing on an upward trajectory, although starting from a lower point than where the pre-COVID trend would have predicted.
Recovery Trend: The post-COVID section of the blue line is steeper than the pre-COVID section, suggesting that the rate of growth in GDP per capita after the initial pandemic shock may be faster than the growth rate before the pandemic.
Code
stargazer( ts, type ="text", dep.var.labels = ("GDP Per Capita"),column.labels = ("Model results"),covariate.labels =c("Time", "Treatment", "Time Since Treatment"),omit.stat ="all", digits =2 )
================================================
Dependent variable:
---------------------------
GDP Per Capita
Model results
------------------------------------------------
Time 224.26***
(23.05)
Treatment -5,566.75***
(438.41)
Time Since Treatment 306.49***
(29.61)
Constant 19,112.23***
(182.95)
================================================
================================================
Note: *p<0.1; **p<0.05; ***p<0.01
The interrupted regression result presented describes the impact of the onset of the COVID-19 pandemic on GDP per capita over time. Here’s a detailed breakdown of the model’s components and the statistical outputs:
Time (Ts): The coefficient of 224.26 (with a standard error of 23.05) and significance indicated by three asterisks (***), suggesting a p-value less than 0.01, indicates that for every unit increase in time, the GDP per capita increases by approximately 224.26 units, assuming no treatment and not considering the passage of time since the treatment. This shows a general trend of GDP growth over time under normal circumstances.
Treatment (D): The treatment effect is -5,566.75 (with a standard error of 438.41), also highly significant (***). This suggests that the introduction of the treatment (the onset of the pandemic) leads to an immediate drop in GDP per capita by approximately 5,566.75 units. This captures the initial shock of the event on the economy.
Time Since Treatment (P): The coefficient of 306.49 (with a standard error of 29.61) and significance (***), indicates that for each unit of time after the treatment, GDP per capita increases by about 306.49 units. This represents a recovery trajectory where, after the initial shock, GDP per capita begins to recover at this rate.
In summary, the model indicates that while the treatment had a significant negative impact on GDP per capita, there has been a subsequent positive rate of recovery over time following the initial shock. This provides a quantified insight into the economic impact of the event and its aftermath.
1.2 Stock Price
Code
# Set options to suppress warningsoptions("getSymbols.warning4.0"=FALSE)options("getSymbols.yahoo.warning"=FALSE)# Define the tickerstickers <-c("PFE")# Loop through tickers to get stock datafor (ticker in tickers) {getSymbols(ticker,from ="2016-01-01",to ="2024-01-01")}# Create a data frame with adjusted closing pricesstock <-data.frame(date =index(PFE), value =Ad(PFE))# data glimpsehead(stock, 3)
index_of_2020_02_20 <-which(stock$date ==as.Date("2020-02-20"))#index_of_2020_02_20 #1040plot( dataTS$Ts, dataTS$Y,bty="n", pch=19, col="gray",xlab ="Time (days)", ylab ="Pfizer Stock Price" )# Line marking the interruptionabline( v=1039, col="firebrick", lty=2 )text( 700, 40, "Start of COVID", col="firebrick", cex=1.3, pos=4 )# Add the regression linets <-lm( Y ~ Ts + D + P, data=dataTS )lines( dataTS$Ts, ts$fitted.values, col="steelblue", lwd=2 )
Trend Before COVID-19: Before the dashed red vertical line that denotes the start of COVID-19, there is a blue line indicating a general upward trend in Pfizer’s stock price. This suggests that Pfizer’s stock was gradually increasing in value over time before the pandemic began.
Start of COVID-19: The dashed red vertical line indicates the point at which the COVID-19 pandemic started. This is a crucial time marker for the analysis.
Trend After COVID-19: After the start of COVID-19, the plot shows significant volatility in Pfizer’s stock price. The stock price initially follows the pre-pandemic trend and continues to increase but then shows some fluctuation before sharply rising. This sharp rise could be due to various factors, potentially including positive news about vaccine development or other pharmaceutical advances related to COVID-19 made by Pfizer.
Overall Pattern: Towards the right end of the plot, after a peak, there is a noticeable decline in the stock price, which may indicate a period of correction or response to other market or global factors.
================================================
Dependent variable:
---------------------------
Pfizer Stock Price
Model results
------------------------------------------------
Time 0.01***
(0.001)
Treatment 2.29**
(0.92)
Time Since Treatment -0.002***
(0.001)
Constant 21.56***
(0.31)
================================================
================================================
Note: *p<0.1; **p<0.05; ***p<0.01
The regression results presented show impact of the onset of the COVID-19 pandemic on the stock price of Pfizer. The regression model includes variables for time, treatment, and the time since treatment was introduced. Here’s a breakdown of each component of the output:
Time (Ts): The coefficient for time is 0.01 with a p-value of less than 0.01 (indicated by ***), suggesting that it is highly statistically significant. This implies that, on average, the stock price of Pfizer has been increasing by 0.01 units each time unit regardless of other factors in the model.
Treatment (D): The treatment variable has a coefficient of 2.29 with a p-value of less than 0.05 (**), indicating a statistically significant positive effect on the Pfizer stock price. This suggests that the onset of the COVID-19 pandemic led to an average increase in Pfizer’s stock price by 2.29 units at the time of the treatment’s implementation.
Time Since Treatment (P): The coefficient for time since treatment is -0.002 with a p-value of less than 0.01 (***), which is highly significant. This indicates that following the treatment, the stock price decreases by an average of 0.002 units per time unit. This could suggest that the initial positive impact of the treatment diminishes over time.
The model suggests that the Pfizer stock price has a general upward trend over time. There was a significant increase in the stock price at the time of treatment, which means the investment of COVID-19 vaccinates could be helpful for the stock price during some periods of COVID-19. However, the effect of COVID-19 diminishes slightly over time, indicating that while the intervention had a positive immediate impact, its effect lessens as time progresses.